﻿// ********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// This code is licensed under the Microsoft Public License.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
// ********************************************************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Microsoft.Health.Web.Mvc;

namespace MvcHelloWorld
{
    public class AccountController : Controller
    {
        public ActionResult LogOn()
        {
            if (!HttpContext.User.Identity.IsAuthenticated)
            {
                return HealthVault.SignIn(ControllerContext);
            }

            return RedirectToAction("Index", "Home");
        }

        public ActionResult LogOff()
        {
            if (HttpContext.User.Identity.IsAuthenticated)
            {
                return HealthVault.SignOut(ControllerContext);
            }

            return RedirectToAction("Index", "Home");
        }
    }
}
